{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from minepy import MINE\n",
    "from joblib  import Parallel,delayed\n",
    "import numpy as np\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "xgb_pred0829 = pd.read_csv('./preds_for_bagging/xgb_pred0829.csv')\n",
    "gbc_pred0819 = pd.read_csv('./preds_for_bagging/gbc_pred0819.csv')\n",
    "lgb_pred_en_8079 = pd.read_csv('./preds_for_bagging/lgb_pred_en_8079.csv')\n",
    "lgb_pred_0819 = pd.read_csv('./preds_for_bagging/lgb_pred_0819.txt')\n",
    "lgb_pred_080971 = pd.read_csv('./preds_for_bagging/lgb_pred_080971.txt')\n",
    "voting_pred_08121 = pd.read_csv('./preds_for_bagging/voting_pred_08121.txt')\n",
    "lgb0_pred_0817 = pd.read_csv('./preds_for_bagging/lgb0_pred_0817.txt')\n",
    "xgb_pred_330_08242 = pd.read_csv('./preds_for_bagging/xgb_pred_330_08242.txt')\n",
    "xgbtest1_pred_083046 = pd.read_csv('./preds_for_bagging/xgbtest1_pred_083046.txt')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred = pd.DataFrame()\n",
    "pred['id'] = xgb_pred0829.id\n",
    "pred['prob'] = (3*xgb_pred0829.prob + gbc_pred0819.prob + rfc_pred_0785.prob+\n",
    "    lgb_pred_en_8079.prob + lgb_pred_0819.prob + 1.5*lgb_pred_0823.prob)\n",
    "pred.to_csv('test1_pred.txt',index=False)    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 0.83372986969915"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred = pd.DataFrame()\n",
    "pred['id'] = xgb_pred0829.id\n",
    "pred['prob'] = (3*xgb_pred0829.prob + gbc_pred0819.prob + 0.5*rfc_pred_0785.prob+\n",
    "    lgb_pred_en_8079.prob + lgb_pred_0819.prob + 1.5*lgb_pred_0823.prob)\n",
    "pred.to_csv('test2_pred.txt',index=False) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 0.83398138640327"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred = pd.DataFrame()\n",
    "pred['id'] = xgb_pred0829.id\n",
    "pred['prob'] = (3*xgb_pred0829.prob + gbc_pred0819.prob +\n",
    "    lgb_pred_en_8079.prob + lgb_pred_0819.prob + 1.5*lgb_pred_0823.prob)\n",
    "pred.to_csv('test3_pred.txt',index=False) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 0.8342"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred = pd.DataFrame()\n",
    "pred['id'] = xgb_pred0829.id\n",
    "pred['prob'] = (3*xgb_pred.prob + gbc_pred0819.prob +\n",
    "     + lgb_pred_0819.prob + 1.5*lgb_pred_0823.prob)\n",
    "pred.to_csv('test4_pred.txt',index=False) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 0.8341"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred = pd.DataFrame()\n",
    "pred['id'] = xgb_pred0829.id\n",
    "pred['prob'] = (3*xgb_pred0829.prob + gbc_pred0819.prob +\n",
    "    0.8*lgb_pred_en_8079.prob + lgb_pred_0819.prob + 1.5*lgb_pred_0823.prob + \n",
    "    0.9*lgb_pred_0811.prob)\n",
    "pred.to_csv('test5_pred.txt',index=False) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 0.83444912867023"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred = pd.DataFrame()\n",
    "pred['id'] = xgb_pred0829.id\n",
    "pred['prob'] = (2*xgb_pred0829.prob + gbc_pred0819.prob +\n",
    "    0.8*lgb_pred_en_8079.prob + lgb_pred_0819.prob + 1.5*lgb_pred_0823.prob + \n",
    "    0.9*lgb_pred_0811.prob)\n",
    "pred.to_csv('test6_pred.txt',index=False) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 0.83440247066335"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred = pd.DataFrame()\n",
    "pred['id'] = xgb_pred0829.id\n",
    "pred['prob'] = (3*xgb_pred0829.prob + gbc_pred0819.prob +\n",
    "    0.8*lgb_pred_en_8079.prob  + 1.5*lgb_pred_0823.prob + \n",
    "    0.9*lgb_pred_080971.prob)\n",
    "pred.to_csv('test7_pred.txt',index=False) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 0.8343"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred = pd.DataFrame()\n",
    "pred['id'] = xgb_pred0829.id\n",
    "pred['prob'] = (3*xgb_pred0829.prob + 1.2*gbc_pred0819.prob +\n",
    "    0.8*lgb_pred_en_8079.prob  + 1.2*lgb_pred_0819.prob + \n",
    "    0.9*lgb_pred_080971.prob + 1.1*lgb0_pred_0817.prob +\n",
    "    voting_pred_08121.prob)\n",
    "pred.to_csv('test8_pred.txt',index=False) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 0.83346590897012"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred = pd.DataFrame()\n",
    "pred['id'] = xgb_pred0829.id\n",
    "pred['prob'] = (3*xgb_pred0829.prob + gbc_pred0819.prob +\n",
    "    lgb_pred_en_8079.prob  + lgb_pred_0819.prob + \n",
    "    lgb_pred_080971.prob + lgb0_pred_0817.prob +\n",
    "    voting_pred_08121.prob)\n",
    "pred.to_csv('test9_pred.txt',index=False) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 0.83340298 "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred = pd.DataFrame()\n",
    "pred['id'] = xgb_pred0829.id\n",
    "pred['prob'] = (3*xgb_pred0829.prob + gbc_pred0819.prob +\n",
    "    0.1*lgb_pred_en_8079.prob  + lgb_pred_0819.prob + \n",
    "    0.1*lgb_pred_080971.prob + lgb0_pred_0817.prob +\n",
    "    0.6*voting_pred_08121.prob)\n",
    "pred.to_csv('test10_pred.txt',index=False) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    " # 0.83316053429938"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred = pd.DataFrame()\n",
    "pred['id'] = xgb_pred0829.id\n",
    "pred['prob'] = (3*xgb_pred0829.prob + gbc_pred0819.prob +\n",
    "    lgb_pred_en_8079.prob + lgb_pred_0819.prob +\n",
    "    lgb_pred_080971.prob )\n",
    "pred.to_csv('tes11_pred.txt',index=False) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 0.83406276862547"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred = pd.DataFrame()\n",
    "pred['id'] = xgb_pred0829.id\n",
    "pred['prob'] = (lgb_pred_080971.prob + voting_pred_08121.prob + \n",
    "                lgb_pred_0819.prob + gbc_pred0819.prob + \n",
    "                lgb_pred_en_8079.prob + xgb_pred_330_08242.prob + \n",
    "                lgb0_pred_0817.prob )\n",
    "pred.to_csv('tes12_pred.txt',index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 0.83048831459289"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test13"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred = pd.DataFrame()\n",
    "pred['id'] = xgb_pred0829.id\n",
    "pred['prob'] = (3*xgbtest1_pred_083046.prob + lgb_pred_en_8079.prob+\n",
    "                lgb_pred_080971.prob + gbc_pred0819.prob + \n",
    "                lgb_pred_en_8079.prob + 1.5*xgb_pred_330_08242.prob + \n",
    "                lgb0_pred_0817.prob + voting_pred_08121.prob)\n",
    "pred.to_csv('tes13_pred.txt',index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 0.83165907340203"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test 14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred = pd.DataFrame()\n",
    "pred['id'] = xgb_pred0829.id\n",
    "pred['prob'] = (4*xgbtest1_pred_083046.prob + lgb_pred_en_8079.prob+\n",
    "                lgb_pred_080971.prob + gbc_pred0819.prob + \n",
    "                lgb_pred_en_8079.prob + lgb0_pred_0817.prob + voting_pred_08121.prob)\n",
    "pred.to_csv('tes14_pred.txt',index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 0.83120814048992"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred = pd.DataFrame()\n",
    "pred['id'] = xgb_pred0829.id\n",
    "pred['prob'] = (1.5*xgbtest1_pred_083046.prob + 1.5*xgb_pred0829.prob + \n",
    "                gbc_pred0819.prob + lgb_pred_en_8079.prob + \n",
    "                lgb_pred_0819.prob + lgb_pred_080971.prob )\n",
    "pred.to_csv('test15_pred.txt',index=False) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
